Codeforces Global Round 19 A~F 您所在的位置:网站首页 codeforces 1500分 Codeforces Global Round 19 A~F

Codeforces Global Round 19 A~F

#Codeforces Global Round 19 A~F| 来源: 网络整理| 查看: 265

A. Sorting Parts

题意:给定一个数组,你可以选择 len\in [1, n-1] ,然后将前 len 个元素排序;再将后 len 个元素排序。问,能否选择合适的 len ,使得操作后,原数组不有序。

分析:如果原先数组无序,选 len=1 ;否则选什么都不行。所以问题转化为判断原数组是否有序。

代码:

string solve() { int n;cin>>n; int a[n+1]; for(int i=1;i>a[i]; for(int i=2;in; int a[n+1]; for(int i=1;i>a[i]; a[i] = 1 + !a[i]; } int ans = 0; for(int i=1;i


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有